 Ext.define('Triends.view.PushPage', {
 	extend: 'Ext.Panel',
 	xtype: 'pushpage',
 	id: 'pushpage',
 	config: {
 		fullscreen: true,
 		layout: 'vbox',
 		scrollable: false,
 		style: 'background:white',
 		items: [
 		{
			xtype: 'titlebar',
			title: 'Push', 
 			ui: 'light',
 			docked: 'top'
		},
	   	{
			xtype: 'formpanel',
			flex: 1,
			id: 'pushform',
			items: [{
				xtype: 'fieldset',
				items: [{
					xtype: 'checkboxfield',
	            	id : 'pushnoti',
	            	name: 'pushnoti',
	            	label: 'Push알림',
	            	labelWidth: 100,
	            	listeners: {
						check: function(){
							var UserStore = Ext.getStore('UserStore');
			    			var userid = UserStore.getAt(0).data.ID;
							var pushnoti = 1;
							Ext.data.JsonP.request({
							   	url: 'http://itscreater.cafe24.com/Triends/gcmmodify.jsp',
							   	params: {
							   		id: userid,
							   		device: 0,
							   		push: pushnoti
							  	},
							   	callbackKey: 'callback',
							   	success: function() {
							   	}
							});
						},
						uncheck: function() {
							Ext.getCmp('vibratenoti').setChecked(false);
							var UserStore = Ext.getStore('UserStore');
			    			var userid = UserStore.getAt(0).data.ID;
							var pushnoti = 0;
							Ext.data.JsonP.request({
							   	url: 'http://itscreater.cafe24.com/Triends/gcmmodify.jsp',
							   	params: {
							   		id: userid,
							   		device: 0,
							   		push: pushnoti
							  	},
							   	callbackKey: 'callback',
							   	success: function() {
							   	}
							});
						}
	            	}
				},
				{
	            	xtype: 'checkboxfield',
	            	id : 'vibratenoti',
	            	name: 'vibratenoti',
	            	label: '진동알림',
	            	labelWidth: 100,
	            	listeners: {
						check: function() {
							Ext.getCmp('pushnoti').setChecked(true);
							var UserStore = Ext.getStore('UserStore');
			    			var userid = UserStore.getAt(0).data.ID;	
			    			var vibratenoti = 1; 
							Ext.data.JsonP.request({
							   	url: 'http://itscreater.cafe24.com/Triends/gcmmodify.jsp',
							   	params: {
							   		id: userid,
							   		device: 0,
							   		vibrate: vibratenoti
							  	},
							   	callbackKey: 'callback',
							   	success: function() {
							   	}
							});
						},
						uncheck:function(){
							var UserStore = Ext.getStore('UserStore');
			    			var userid = UserStore.getAt(0).data.ID;	
			    			var vibratenoti = 0; 
							Ext.data.JsonP.request({
							   	url: 'http://itscreater.cafe24.com/Triends/gcmmodify.jsp',
							   	params: {
							   		id: userid,
							   		device: 0,
							   		vibrate: vibratenoti
							  	},
							   	callbackKey: 'callback',
							   	success: function() {
							   	}
							});
						}
	            	}
		   		}]
        	}]
	   	}]
 	}
 });